// === toolbar default base with scrolling arrows etc.
group { name: "elm/toolbar/base/default";
   parts {
      part { name: "base"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/bg/normal/toolbar";
         }
      }
      part { name: "clipper"; type: RECT;
         description { state: "default" 0.0;
            rel.to: "base";
         }
      }
      part { name: "elm.swallow.content"; type: SWALLOW;
         clip_to: "clipper";
         description { state: "default" 0.0;
         }
      }
      part { name: "arrow_clipper_l"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "arrow_l_ev"; type: RECT;
         scale: 1;
         clip_to: "arrow_clipper_l";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "base";
            align: 0.0 0.5;
            color_class: "/dim/normal/toolbar/arrow";
            FIXED_SIZE(23, 23)
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/dim/pressed/toolbar/arrow";
         }
      }
      part { name: "arrow_l"; mouse_events: 0;
         scale: 1;
         clip_to: "arrow_clipper_l";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "arrow_l_ev";
            image.normal: "i-arrow-l";
            FIXED_SIZE(15, 15)
            color_class: "/fg/normal/toolbar/arrow";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/toolbar/arrow";
         }
      }

      part { name: "arrow_clipper_r"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "arrow_r_ev"; type: RECT;
         scale: 1;
         clip_to: "arrow_clipper_r";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "base";
            align: 1.0 0.5;
            color_class: "/dim/normal/toolbar/arrow";
            FIXED_SIZE(23, 23)
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/dim/pressed/toolbar/arrow";
         }
      }
      part { name: "arrow_r"; mouse_events: 0;
         scale: 1;
         clip_to: "arrow_clipper_r";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "arrow_r_ev";
            image.normal: "i-arrow-r";
            FIXED_SIZE(15, 15)
            color_class: "/fg/normal/toolbar/arrow";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/toolbar/arrow";
         }
      }

      part { name: "arrow_clipper_u"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "arrow_u_ev"; type: RECT;
         scale: 1;
         clip_to: "arrow_clipper_u";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "base";
            align: 0.5 0.0;
            color_class: "/dim/normal/toolbar/arrow";
            FIXED_SIZE(23, 23)
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/dim/pressed/toolbar/arrow";
         }
      }
      part { name: "arrow_u"; mouse_events: 0;
         scale: 1;
         clip_to: "arrow_clipper_u";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "arrow_u_ev";
            image.normal: "i-arrow-u";
            FIXED_SIZE(15, 15)
            color_class: "/fg/normal/toolbar/arrow";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/toolbar/arrow";
         }
      }

      part { name: "arrow_clipper_d"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "arrow_d_ev"; type: RECT;
         scale: 1;
         clip_to: "arrow_clipper_d";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "base";
            align: 0.5 1.0;
            color_class: "/dim/normal/toolbar/arrow";
            FIXED_SIZE(23, 23)
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/dim/pressed/toolbar/arrow";
         }
      }
      part { name: "arrow_d"; mouse_events: 0;
         scale: 1;
         clip_to: "arrow_clipper_d";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "arrow_d_ev";
            image.normal: "i-arrow-d";
            FIXED_SIZE(15, 15)
            color_class: "/fg/normal/toolbar/arrow";
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/toolbar/arrow";
         }
      }
   }
   programs {
//      program {
//         signal: "elm,orient,horizontal"; source: "elm";
//      }
//      program {
//         signal: "elm,orient,vertical"; source: "elm";
//      }
      program { signal: "elm,action,show,left"; source: "elm";
         action: STATE_SET "visible" 0.0;
         target: "arrow_clipper_l";
      }
      program { signal: "elm,action,hide,left"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "arrow_clipper_l";
      }
      program { signal: "mouse,down,1*"; source: "arrow_l_ev";
         action: SIGNAL_EMIT "elm,action,left" "elm";
         after: "arrow_l_repeat";
      }
      program { name: "arrow_l_repeat";
         action: SIGNAL_EMIT "elm,action,left" "elm";
         in: 0.3 0.0;
         after: "arrow_l_repeat";
      }
      program { signal: "mouse,up,1"; source: "arrow_l_ev";
         action: ACTION_STOP;
         target: "arrow_l_repeat";
      }
      program { signal: "mouse,down,1*"; source: "arrow_l_ev";
         action: STATE_SET "clicked" 0.0;
         target: "arrow_l";
      }
      program { signal: "mouse,up,1"; source: "arrow_l_ev";
         action: STATE_SET "default" 0.0;
         target: "arrow_l";
      }

      program { signal: "elm,action,show,right"; source: "elm";
         action: STATE_SET "visible" 0.0;
         target: "arrow_clipper_r";
      }
      program { signal: "elm,action,hide,right"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "arrow_clipper_r";
      }
      program { signal: "mouse,down,1*"; source: "arrow_r_ev";
         action: SIGNAL_EMIT "elm,action,right" "elm";
         after: "arrow_r_repeat";
      }
      program { name: "arrow_r_repeat";
         action: SIGNAL_EMIT "elm,action,right" "elm";
         in: 0.3 0.0;
         after: "arrow_r_repeat";
      }
      program { signal: "mouse,up,1"; source: "arrow_r_ev";
         action: ACTION_STOP;
         target: "arrow_r_repeat";
      }
      program { signal: "mouse,down,1*"; source: "arrow_r_ev";
         action: STATE_SET "clicked" 0.0;
         target: "arrow_r";
      }
      program { signal: "mouse,up,1"; source: "arrow_r_ev";
         action: STATE_SET "default" 0.0;
         target: "arrow_r";
      }

      program { signal: "elm,action,show,up"; source: "elm";
         action: STATE_SET "visible" 0.0;
         target: "arrow_clipper_u";
      }
      program { signal: "elm,action,hide,up"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "arrow_clipper_u";
      }
      program { signal: "mouse,down,1*"; source: "arrow_u_ev";
         action: SIGNAL_EMIT "elm,action,up" "elm";
         after: "arrow_u_repeat";
      }
      program { name: "arrow_u_repeat";
         action: SIGNAL_EMIT "elm,action,up" "elm";
         in: 0.3 0.0;
         after: "arrow_u_repeat";
      }
      program { signal: "mouse,up,1"; source: "arrow_u_ev";
         action: ACTION_STOP;
         target: "arrow_u_repeat";
      }
      program { signal: "mouse,down,1*"; source: "arrow_u_ev";
         action: STATE_SET "clicked" 0.0;
         target: "arrow_u";
      }
      program { signal: "mouse,up,1"; source: "arrow_u_ev";
         action: STATE_SET "default" 0.0;
         target: "arrow_u";
      }

      program { signal: "elm,action,show,down"; source: "elm";
         action: STATE_SET "visible" 0.0;
         target: "arrow_clipper_d";
      }
      program { signal: "elm,action,hide,down"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "arrow_clipper_d";
      }
      program { signal: "mouse,down,1*"; source: "arrow_d_ev";
         action: SIGNAL_EMIT "elm,action,down" "elm";
         after: "arrow_d_repeat";
      }
      program { name: "arrow_d_repeat";
         action: SIGNAL_EMIT "elm,action,down" "elm";
         in: 0.3 0.0;
         after: "arrow_d_repeat";
      }
      program { signal: "mouse,up,1"; source: "arrow_d_ev";
         action: ACTION_STOP;
         target: "arrow_d_repeat";
      }
      program { signal: "mouse,down,1*"; source: "arrow_d_ev";
         action: STATE_SET "clicked" 0.0;
         target: "arrow_d";
      }
      program { signal: "mouse,up,1"; source: "arrow_d_ev";
         action: STATE_SET "default" 0.0;
         target: "arrow_d";
      }
   }
}

// === item: standard default item
group { name: "elm/toolbar/item/default";
   alias: "elm/toolbar/item/item_centered";
   data.item: "transition_animation_on" "1";
   data.item: "focusraise" "on";
   script {
      public btmode;
      public eval_mode(m) {
         new m1 = m & MASK;
         new d = m & DISABLE;
         if (m1 == (ICON | LABEL)) {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "default", 0.0);
               set_state(PART:"elm.swallow.icon_new", "default", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "default", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "default", 0.0);
               set_state(PART:"elm.swallow.icon_new", "default", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "disabled", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         } else if (m1 == (ICON)) {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "icononly", 0.0);
               set_state(PART:"elm.swallow.icon_new", "icononly", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "icononly", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "icononly", 0.0);
               set_state(PART:"elm.swallow.icon_new", "icononly", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "icononly", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         } else if (m1 == (LABEL)) {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"elm.swallow.icon_new", "noicon", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "noicon", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"elm.swallow.icon_new", "noicon", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "noicon_disabled", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         } else {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"elm.swallow.icon_new", "noicon", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "noicon", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"elm.swallow.icon_new", "noicon", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "noicon_disabled", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         }
      }
   }
   parts {
      part { name: "base"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/bg/normal/toolbar/base";
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/selected/toolbar/base";
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }

      part { name: "icon_clip"; type: RECT;
         description { state: "default" 0.0;
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 64; // no cc
         }
      }
      part { name: "icon_clip1"; type: RECT;
         clip_to: "icon_clip";
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
      }

      part { name: "elm.swallow.icon"; type: SWALLOW;
         clip_to: "icon_clip1";
         scale: 1;
         description { state: "default" 0.0;
            align: 0.5 0.5;
            rel1.relative: 0.0 0.0;
            rel1.offset: 4 4;
            rel2.to_y: "elm.text";
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            min: ICMIN ICMIN;
            offscale;
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            visible: 0;
            rel1.offset: 4 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            min: 0 0;
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            visible: 1;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
            rel2.to_y: "icon_clip";
            min: ICMIN ICMIN;
         }
      }
      part { name: "icon_clip2"; type: RECT;
         clip_to: "icon_clip";
         description { state: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "elm.swallow.icon_new"; type: SWALLOW;
         clip_to: "icon_clip2";
         scale: 1;
         description { state: "default" 0.0;
            align: 0.5 0.5;
            rel1.relative: 0.0 0.0;
            rel1.offset: 4 4;
            rel2.to_y: "elm.text";
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            min: ICMIN ICMIN;
            offscale;
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            visible: 0;
            rel1.offset: 4 0;
            rel2.relative: 1.0 0.0;
            rel2.offset: -5 0;
            min: 0 0;
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            visible: 1;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
            rel2.to_y: "icon_clip";
            min: ICMIN ICMIN;
         }
      }

      part { name: "text_clip1"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
      }
      part { name: "elm.text"; type: TEXT; mouse_events: 0;
         scale: 1;
         clip_to: "text_clip1";
         description { state: "default" 0.0;
            rel1.offset: 4 -5;
            rel1.relative: 0.0 1.0;
            rel2.offset: -5 -5;
            align: 0.5 1.0;
            color_class: "/fg/normal/toolbar/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.5 1.0;
               text_class: "toolbar_item";
            }
            fixed: 0 1;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/toolbar/text";
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            rel1.offset: 4 -5;
            rel1.relative: 0.0 1.0;
         }
         description { state: "noicon_disabled" 0.0;
            inherit: "noicon" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            text.min: 0 0;
            visible: 0;
            fixed: 1 1;
         }
      }
      part { name: "text_clip2"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "elm.text_new"; type: TEXT; mouse_events: 0;
         scale: 1;
         clip_to: "text_clip2";
         description { state: "default" 0.0;
            rel1.offset: 4 -5;
            rel1.relative: 0.0 1.0;
            rel2.offset: -5 -5;
            align: 0.5 1.0;
            color_class: "/fg/normal/toolbar/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.5 1.0;
               text_class: "toolbar_item";
            }
            fixed: 0 1;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/toolbar/text";
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            rel1.offset: 4 -5;
            rel1.relative: 0.0 1.0;
         }
         description { state: "noicon_disabled" 0.0;
            inherit: "noicon" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            text.min: 0 0;
            visible: 0;
            fixed: 1 1;
         }
      }

      part { name: "bar"; type: RECT; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            fixed: 0 1;
            rel.to: "base";
            rel1.offset: 0 -1;
            rel1.relative: 0.0 1.0;
            rel2.offset: -1 -1;
            align: 0.5 1.0;
            color_class: "/bg/selected/toolbar/bar";
            visible: 0;
            min: 0 0;
            max: 99999 0;

         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            min: 0 5;
            max: 99999 5;
            visible: 1;
         }
      }
      part { name: "event"; type: RECT;
         ignore_flags: ON_HOLD;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
//      program { signal: "elm,orient,horizontal"; source: "elm";
//         action: STATE_SET "default" 0.0;
//      }
//      program { signal: "elm,orient,vertical"; source: "elm";
//         action: STATE_SET "vert" 0.0;
//      }
      program { name: "st0";
         signal: "load"; source: "";
         script {
            set_int(btmode, LABEL | ICON);
         }
      }
      program { signal: "elm,state,selected"; source: "elm";
         action: STATE_SET "selected" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "elm,state,unselected"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "mouse,down,1"; source: "event";
         action: STATE_SET "selected" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "mouse,up,1"; source: "event";
         action: STATE_SET "default" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "mouse,up,1"; source: "event";
         action: SIGNAL_EMIT "elm,action,click" "elm";
      }
      program { signal: "elm,highlight,on"; source: "elm";
         action: STATE_SET "selected" 0.0;
         target: "base";
         target: "bar";
      }
      program { signal: "elm,highlight,off"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
         target: "bar";
      }
      program { signal:  "mouse,in"; source:  "event";
         action:  SIGNAL_EMIT "elm,mouse,in" "elm";
      }
      program { signal:  "mouse,out"; source:  "event";
         action:  SIGNAL_EMIT "elm,mouse,out" "elm";
      }
      program { name: "st1";
         signal: "elm,text,hidden"; source: "elm";
         script {
            new m = get_int(btmode);
            m &= ~LABEL; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st2";
         signal: "elm,text,visible"; source: "elm";
         script {
            new m = get_int(btmode);
            m |= LABEL; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st3";
         signal: "elm,icon,hidden"; source: "elm";
         script {
            new m = get_int(btmode);
            m &= ~ICON; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st4";
         signal: "elm,icon,visible"; source: "elm";
         script {
            new m = get_int(btmode);
            m |= ICON; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st5";
         signal: "elm,state,disabled"; source: "elm";
         script {
            new m = get_int(btmode);
            m |= DISABLE; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st6";
         signal: "elm,state,enabled"; source: "elm";
         script {
            new m = get_int(btmode);
            m &= ~DISABLE; set_int(btmode, m);
            eval_mode(m);
         }
      }
//      program { signal: "elm,state,moving"; source: "elm";
//         action: STATE_SET "default" 0.0;
//      }
      program { signal: "elm,state,icon_set,forward"; source: "elm";
         after: "icon_set,animation";
      }
      program {
         signal: "elm,state,icon_set,backward"; source: "elm";
         after: "icon_set,animation";
      }
      program { name: "icon_set,animation";
         signal: "elm,state,icon_set"; source: "elm";
         action: STATE_SET "animation" 0.0;
         target: "icon_clip1";
         target: "icon_clip2";
         transition: LINEAR 0.2;
         after: "icon_set,animation,done";
      }
      program { name: "icon_set,animation,done";
         action: SIGNAL_EMIT "elm,state,icon_set,done" "elm";
      }

      program { signal: "elm,state,icon,reset"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "icon_clip1";
         target: "icon_clip2";
      }

      program { signal: "elm,state,label_set,forward"; source: "elm";
         after: "label_set,animation";
      }
      program { signal: "elm,state,label_set,backward"; source: "elm";
         after: "label_set,animation";
      }
      program { name: "label_set,animation";
         signal: "elm,state,label_set"; source: "elm";
         action: STATE_SET "animation" 0.0;
         target: "text_clip1";
         target: "text_clip2";
         transition: LINEAR 0.2;
         after: "label_set,animation,done";
      }
      program { name: "label_set,animation,done";
         action: SIGNAL_EMIT "elm,state,label_set,done" "elm";
      }

      program { signal: "elm,state,label,reset"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "text_clip1";
         target: "text_clip2";
      }
   }
}

// === item: style assumed to exist
group { name: "elm/toolbar/item/item_horizontal";
   data.item: "transition_animation_on" "1";
   data.item: "focusraise" "on";

   script {
      public btmode;
      public eval_mode(m) {
         new m1 = m & MASK;
         new d = m & DISABLE;
         if (m1 == (ICON | LABEL)) {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "default", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "default", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "default", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "disabled", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         } else if (m1 == (ICON)) {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "icononly", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "icononly", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "icononly", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "icononly", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         } else if (m1 == (LABEL)) {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "noicon", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "noicon_disabled", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         } else {
            if (!d) {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "default", 0.0);
               set_state(PART:"elm.text", "noicon", 0.0);
               set_state(PART:"event", "default", 0.0);
            } else {
               set_state(PART:"elm.swallow.icon", "noicon", 0.0);
               set_state(PART:"icon_clip", "disabled", 0.0);
               set_state(PART:"elm.text", "noicon_disabled", 0.0);
               set_state(PART:"event", "disabled", 0.0);
            }
         }
      }
   }
   parts {
      part { name: "base"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/bg/normal/toolbar/base";
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/selected/toolbar/base";
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }

      part { name: "icon_clip"; type: RECT;
         description { state: "default" 0.0;
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 64; // no cc
         }
      }
      part { name: "icon_clip1"; type: RECT;
         clip_to: "icon_clip";
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
      }
      part { name: "elm.swallow.icon"; type: SWALLOW;
         clip_to: "icon_clip1";
         scale: 1;
         description { state: "default" 0.0;
            align: 0.0 0.5;
            rel1.relative: 0.0 0.0;
            rel1.offset: 4 4;
            rel2.relative: 0.0 1.0;
            rel2.offset: 4 -5;
            offscale;
            min: ICMIN ICMIN;
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            visible: 0;
            rel1.offset: 0 4;
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -5;
            min: 0 0;
            fixed: 1 1;
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
            rel2.to_x: "icon_clip";
            min: ICMIN ICMIN;
         }
      }
      part { name: "icon_clip2"; type: RECT;
         clip_to: "icon_clip";
         description { state: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "elm.swallow.icon_new"; type: SWALLOW;
         clip_to: "icon_clip2";
         scale: 1;
         description { state: "default" 0.0;
            align: 0.0 0.5;
            rel1.relative: 0.0 0.0;
            rel1.offset: 4 4;
            rel2.relative: 0.0 1.0;
            rel2.offset: 4 -5;
            offscale;
            min: ICMIN ICMIN;
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            visible: 0;
            rel1.offset: 0 4;
            rel2.relative: 0.0 1.0;
            rel2.offset: 0 -5;
            min: 0 0;
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
            rel2.to_x: "icon_clip";
            min: ICMIN ICMIN;
         }
      }

      part { name: "text_clip1"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
      }
      part { name: "elm.text"; type: TEXT; mouse_events: 0;
         scale: 1;
         clip_to: "text_clip1";
         description { state: "default" 0.0;
            rel1.offset: 4 4;
            rel1.to_x: "elm.swallow.icon";
            rel1.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            align: 0.0 0.5;
            color_class: "/fg/normal/toolbar/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.0 0.5;
               text_class: "toolbar_item";
            }
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/toolbar/text";
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
         }
         description { state: "noicon_disabled" 0.0;
            inherit: "noicon" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            text.min: 0 0;
            visible: 0;
            fixed: 1 1;
            rel1.offset: 0 4;
            rel1.relative: 0.0 0.0;
            rel1.to_x: "text_clip2";
         }
      }
      part { name: "text_clip2"; type: RECT;
         description { state: "default" 0.0;
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "animation" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "elm.text_new"; type: TEXT; mouse_events: 0;
         scale: 1;
         clip_to: "text_clip2";
         description { state: "default" 0.0;
            rel1.offset: 4 4;
            rel1.relative: 1.0 0.0;
            rel2.offset: -5 -5;
            align: 0.0 0.5;
            color_class: "/fg/normal/toolbar/text";
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               ellipsis: -1;
               align: 0.0 0.5;
               text_class: "toolbar_item";
            }
            fixed: 1 1;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/toolbar/text";
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "noicon" 0.0;
            inherit: "default" 0.0;
            rel1.offset: 4 -5;
            rel2.offset: -5 -5;
            rel1.relative: 0.0 0.0;
            align: 0.0 0.5;
            text.align: 0.0 0.5;
         }
         description { state: "noicon_disabled" 0.0;
            inherit: "noicon" 0.0;
            color_class: "/fg/disabled/toolbar/text";
         }
         description { state: "icononly" 0.0;
            inherit: "default" 0.0;
            text.min: 0 0;
            visible: 0;
            fixed: 1 1;
            rel1.offset: 0 4;
            rel1.relative: 0.0 0.0;
            rel1.to_x: "text_clip2";
         }
      }

      part { name: "bar"; type: RECT; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            fixed: 0 1;
            rel.to: "base";
            rel1.offset: 0 -1;
            rel1.relative: 0.0 1.0;
            rel2.offset: -1 -1;
            align: 0.5 1.0;
            color_class: "/bg/selected/toolbar/bar";
            visible: 0;
            min: 0 0;
            max: 99999 0;

         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            min: 0 5;
            max: 99999 5;
            visible: 1;
         }
      }
      part { name: "event"; type: RECT;
         ignore_flags: ON_HOLD;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
//      program { signal: "elm,orient,horizontal"; source: "elm";
//         action: STATE_SET "default" 0.0;
//      }
//      program { signal: "elm,orient,vertical"; source: "elm";
//         action: STATE_SET "vert" 0.0;
//      }
      program { name: "st0";
         signal: "load"; source: "";
         script {
            set_int(btmode, LABEL | ICON);
         }
      }
      program { signal: "elm,state,selected"; source: "elm";
         action: STATE_SET "selected" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program {
         signal: "elm,state,unselected"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "mouse,down,1"; source: "event";
         action: STATE_SET "selected" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "mouse,up,1"; source: "event";
         action: STATE_SET "default" 0.0;
         target: "elm.text";
         target: "base";
         target: "bar";
      }
      program { signal: "mouse,up,1"; source: "event";
         action: SIGNAL_EMIT "elm,action,click" "elm";
      }
      program { signal: "elm,highlight,on"; source: "elm";
         action: STATE_SET "selected" 0.0;
         target: "base";
         target: "bar";
      }
      program { signal: "elm,highlight,off"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
         target: "bar";
      }
      program { signal:  "mouse,in"; source:  "event";
         action:  SIGNAL_EMIT "elm,mouse,in" "elm";
      }
      program { signal:  "mouse,out"; source:  "event";
         action:  SIGNAL_EMIT "elm,mouse,out" "elm";
      }
      program { name: "st1";
         signal: "elm,text,hidden"; source: "elm";
         script {
            new m = get_int(btmode);
            m &= ~LABEL; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st2";
         signal: "elm,text,visible"; source: "elm";
         script {
            new m = get_int(btmode);
            m |= LABEL; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st3";
         signal: "elm,icon,hidden"; source: "elm";
         script {
            new m = get_int(btmode);
            m &= ~ICON; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st4";
         signal: "elm,icon,visible"; source: "elm";
         script {
            new m = get_int(btmode);
            m |= ICON; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st5";
         signal: "elm,state,disabled"; source: "elm";
         script {
            new m = get_int(btmode);
            m |= DISABLE; set_int(btmode, m);
            eval_mode(m);
         }
      }
      program { name: "st6";
         signal: "elm,state,enabled"; source: "elm";
         script {
            new m = get_int(btmode);
            m &= ~DISABLE; set_int(btmode, m);
            eval_mode(m);
         }
      }
//      program { signal: "elm,state,moving"; source: "elm";
//         action: STATE_SET "default" 0.0;
//      }
      program { signal: "elm,state,icon_set,forward"; source: "elm";
         after: "icon_set,animation";
      }
      program { signal: "elm,state,icon_set,backward"; source: "elm";
         after: "icon_set,animation";
      }
      program { name: "icon_set,animation";
         signal: "elm,state,icon_set"; source: "elm";
         action: STATE_SET "animation" 0.0;
         target: "icon_clip1";
         target: "icon_clip2";
         transition: LINEAR 0.2;
         after: "icon_set,animation,done";
      }
      program { name: "icon_set,animation,done";
         action: SIGNAL_EMIT "elm,state,icon_set,done" "elm";
      }

      program { signal: "elm,state,icon,reset"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "icon_clip1";
         target: "icon_clip2";
      }

      program { signal: "elm,state,label_set,forward"; source: "elm";
         after: "label_set,animation";
      }
      program { signal: "elm,state,label_set,backward"; source: "elm";
         after: "label_set,animation";
      }
      program { name: "label_set,animation";
         signal: "elm,state,label_set"; source: "elm";
         action: STATE_SET "animation" 0.0;
         target: "text_clip1";
         target: "text_clip2";
         transition: LINEAR 0.2;
         after: "label_set,animation,done";
      }
      program { name: "label_set,animation,done";
         action: SIGNAL_EMIT "elm,state,label_set,done" "elm";
      }

      program { signal: "elm,state,label,reset"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "text_clip1";
         target: "text_clip2";
      }
   }
}

// === separator
group { name: "elm/toolbar/separator/default";
   parts {
      part { name: "base"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            min: 1 1;
            max: 1 99999;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            color_class: "/fg/normal/toolbar/separator";
            offscale;
         }
         description { state: "vert" 0.0;
            inherit: "default" 0.0;
            max: 99999 1;
         }
      }
   }
   programs {
      program { signal: "elm,orient,horizontal"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
      }
      program { signal: "elm,orient,vertical"; source: "elm";
         action: STATE_SET "vert" 0.0;
         target: "base";
      }
   }
}

// === item: just a regular object holder in the toolbar for any child
group { name: "elm/toolbar/object/default";
   parts {
      part { name: "base"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/bg/normal/toolbar/base";
            color: 255 255 255 0; // no cc
            visible: 0;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/selected/toolbar/base";
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "elm.swallow.object"; type: SWALLOW;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            offscale;
         }
      }
   }
   programs {
      program { signal: "elm,highlight,on"; source: "elm";
         action: STATE_SET "selected" 0.0;
         target: "base";
      }
      program { signal: "elm,highlight,off"; source: "elm";
         action: STATE_SET "default" 0.0;
         target: "base";
      }
   }
}

// === item: the more PANEL that slides out under the toolbar
// XXX: vert vs horiz (should emit)
group { name: "elm/toolbar/more/default";
   images.image: "win_shad_angle.png" COMP;
   parts {
      WIN_SHAD("base", "shadow", "win_shad_angle.png", 21, 21, 14, 28, 0.5)
      part { name: "shadow"; type: RECT;
         description { state: "default" 0.0;
            rel.to: "base";
            rel1.offset: -1000 -1000;
            rel2.offset: 1000 1000;
            color: 255 255 255 0; // no cc
            color_class: "/shadow/normal/button";
            visible: 0;
         }
         description { state: "open" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
         description { state: "open2" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
            visible: 1;
         }
      }
      part { name: "base"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/bg/normal/toolbar/more";
            rel2.relative: 1.0 0.0;
            fixed: 1 1;
            visible: 0;
         }
         description { state: "open" 0.0;
            inherit: "default" 0.0;
            rel2.relative: 1.0 1.0;
            visible: 1;
         }
         description { state: "open2" 0.0;
            inherit: "default" 0.0;
            rel2.relative: 1.0 2.0;
            visible: 1;
         }
      }
      part { name: "clipper"; type: RECT;
         description { state: "default" 0.0;
            rel.to: "base";
            fixed: 1 1;
            visible: 0;
         }
         description { state: "open" 0.0;
            inherit: "default" 0.0;
            rel2.relative: 1.0 1.0;
            visible: 1;
         }
         description { state: "open2" 0.0;
            inherit: "default" 0.0;
            rel2.relative: 1.0 0.5;
            visible: 1;
         }
      }
      part { name: "clipper2"; type: RECT;
         description { state: "default" 0.0;
            rel1.relative: 0.0 0.5;
            rel.to: "base";
            fixed: 1 1;
            visible: 0;
         }
         description { state: "open" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.0 1.0;
            visible: 1;
         }
         description { state: "open2" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.0 0.5;
            visible: 1;
         }
      }
      part { name: "elm.swallow.content"; type: SWALLOW;
         clip_to: "clipper";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "clipper";
         }
      }
      part { name: "elm.swallow.content2"; type: SWALLOW;
         clip_to: "clipper2";
         description { state: "default" 0.0;
            fixed: 1 1;
            rel.to: "clipper2";
         }
      }
   }
  programs {
     program { signal: "elm,state,open"; source: "elm";
        action: STATE_SET "open" 0.0;
        target: "shadow";
        target: "base";
        target: "clipper";
        target: "clipper2";
        transition: DECELERATE 0.2;
     }
     program { signal: "elm,state,open2"; source: "elm";
        action: STATE_SET "open2" 0.0;
        target: "shadow";
        target: "base";
        target: "clipper";
        target: "clipper2";
        transition: DECELERATE 0.2;
     }
     program { signal: "elm,state,close"; source: "elm";
        action: STATE_SET "default" 0.0;
        target: "shadow";
        target: "base";
        transition: ACCELERATE 0.3;
     }
  }
}
